# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-atari800
pkgver=3.1.0.9
_realname=Matrix
pkgrel=1
pkgdesc="Atari800 for libretro/libco WIP"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.atari800"
arch="x86 x86_64 aarch64 armv7" # kodi
license="GPL-2.0-only"
makedepends="cmake libretro-atari800 kodi-dev"
depends="kodi-game-libretro libretro-atari800"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.atari800/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.atari800-$pkgver-$_realname"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi \
		-DUSE_LTO=1
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
	rm -f "$pkgdir"/usr/lib/kodi/addons/game.libretro.atari800/game.libretro.atari800.so
	ln -s /usr/lib/libretro/atari800_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.atari800/game.libretro.atari800.so
}

sha512sums="60abf022fceda4141c5244906f2a44776ba1b17b6b982e1b3f63d314c811b6bffcb7a6070c66413f461d31a30fca014990af505047b8d331c16ffcb032a5c015  kodi-game-libretro-atari800-3.1.0.9-Matrix.tar.gz"
